// TimeService.h
#ifndef TIME_SERVICE_H
#define TIME_SERVICE_H

#include <NTPClient.h>
#include <WiFiUdp.h>

class TimeService {
public:
    TimeService();
    void begin();
    void update();
    uint8_t getHours();
    uint8_t getMinutes();
    uint8_t getSeconds();
    uint8_t getDayOfWeek(); // 恢复获取星期的方法
    void updateDate();
    
    struct Date { 
        uint16_t year; 
        uint8_t month; 
        uint8_t day;
        uint8_t dayOfWeek; // 恢复星期字段
    };
    
    Date getDate();

private:
    WiFiUDP ntpUDP;
    NTPClient timeClient;
    unsigned long lastUpdate = 0;
    Date currentDate = {2023, 1, 1, 0};
};

#endif